//
//  UILaebl+Extension.swift
//  WKweiBo
//
//  Created by 阿拉斯加的狗 on 15/12/7.
//  Copyright © 2015年 阿拉斯加的🐶. All rights reserved.
//

import UIKit

extension UILabel {
    
    //便利创建标签
    
    convenience init(title: String, color: UIColor = UIColor.darkGrayColor(), fontSize: CGFloat = 14, screenInset: CGFloat = 0) {
    
        self.init()
        
        text = title
        
        textColor = color
        
        font = UIFont.systemFontOfSize(fontSize)
        
        
        numberOfLines = 0

        if screenInset == 0 {
        
        textAlignment = NSTextAlignment.Center
        
        } else {
        
            //设置换行宽度
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenInset
        
            textAlignment = .Left
        }
        

    
    }

}
